home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 7465 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.8 KB  |  49 lines

  1. Newsgroups: comp.lang.c
  2. Path: news.sprintlink.net!news1!news
  3. From: rclark@iquest.net (Robert B. Clark)
  4. Subject: Re: I can't print the date in the format I want.
  5. X-Nntp-Posting-Host: ind-002-236-112.iquest.net
  6. Message-ID: <3131e14b.13865157@news.iquest.net>
  7. Sender: news@iquest.net (News Admin)
  8. Organization: IQuest Internet, Inc.
  9. X-Newsreader: Forte Agent .99d/16.182
  10. References: <4g5nbf$8s0@newsbf02.news.aol.com> <3129e355.114134@news.iquest.net> <825035732snz@genesis.demon.co.uk> <312de5dc.416111@news.iquest.net> <TANMOY.96Feb23175219@qcd.lanl.gov>
  11. Date: Mon, 26 Feb 1996 18:11:47 GMT
  12.  
  13. On 24 Feb 1996 00:52:19 GMT, tanmoy@qcd.lanl.gov (Tanmoy Bhattacharya)
  14. wrote:
  15.  
  16. >In article <312de5dc.416111@news.iquest.net>
  17. >rclark@iquest.net (Robert B. Clark) writes:
  18. >RBC: 
  19. >RBC:     #define PAUSE    if (getchar()) {}
  20. >
  21. >And then, (s)he would be tempted to write:
  22. >
  23. > if (some_funny_condition) PAUSE;
  24. > else just_show_the_results();
  25.  
  26. That would be bad. :-)
  27.  
  28. >Why not the solution suggested in FAQ
  29. >#define PAUSE do { if(getchar()) {} } while(0)
  30. >
  31. >Of course, I have no idea what this is supposed to be doing ... I have
  32. >not been following this thread. #define PAUSE (void)getchar() seems to
  33.  
  34. Actually, the original poster just threw in the getchar() as part of his
  35. debugging efforts--I assumed it was intended to act as "pause" code (as
  36. an aside, the program only displayed about three or four lines of text).
  37.  
  38.  
  39. >ignoring the return value deliberately. In any case, why the compiler
  40. >should think that `code has no effect' is beyond me.
  41.  
  42. "This code has no effect" was the warning message generated by that code
  43. on Borland's Turbo C v3.0.  Sometimes you have to bend over backwards to
  44. do funky things with that compiler.
  45. --
  46. Robert B. Clark <rclark@iquest.net>
  47. "Be wary of strong spirits.  It can make you shoot at tax collectors...
  48. and miss." --RAH
  49.